function swapArray(arr, index1, index2) {
  arr[index1] = arr.splice(index2, 1, arr[index1])[0];
  return arr;
}

export function moveUp(arr, index) {
  if (index === 0) {
    return arr;
  }
  return swapArray(arr, index, index - 1);
}

export function moveDown(arr, index) {
  if (index === arr.length - 1) {
    return arr;
  }
  return swapArray(arr, index, index + 1);
}

export function removeComponent(arr,index){
  return arr.splice(index,1);
}